Skip to content

Sync output of async execution - #286

Open
KillerxDBr wants to merge 3 commits into
tsoding:mainfrom
KillerxDBr:sync_output
Open

KillerxDBr wants to merge 3 commits into
tsoding:mainfrom
KillerxDBr:sync_output

Conversation

@KillerxDBr

Copy link
Copy Markdown
Contributor

After asynchronously compiling some of my old aoc code full of warnings, the compiler output was completelly mangled and unreadable, i had the same problem with makefiles before, but that has an option to sync output, so i implemented it in nob.

The implementation changes Nob_Proc to a struct that store 3 fds(the proc itself and its redirected outputs), use pipes to capture the non redirected output and simply dumps it to standard out/err when the subprocess end (nob_procs_flush or nob__proc_wait_async)

To enable it just set option sync_output to true in nob_cmd_run:

if (!nob_cmd_run(&cmd, .async = &procs, .sync_output = true)) return_defer(1);

Enabled the good old pedantic flag to give me some warnings since i already fixed the old ones
Before:
image

After:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant